package service

import (
	"context"
	__ "exam-pro/user-server/basic/proto"
	"exam-pro/user-server/handler/model"
)

type Server struct {
	__.UnimplementedUserServer
}

func (s *Server) Register(_ context.Context, in *__.RegisterReq) (*__.RegisterResp, error) {

	var user model.User
	user = model.User{
		Username: user.Username,
		Password: user.Password,
	}
	err := model.Register(&user)
	if err != nil {
		return &__.RegisterResp{
			Code: 0,
			Msg:  "注册失败",
		}, nil
	}
	return &__.RegisterResp{
		Code: 200,
		Msg:  "注册成功",
	}, nil
}
